package com.example.controller;

import com.example.service.GoodService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;

@RestController
public class GoodsController {
    @Autowired
    private GoodService goodService;

    @GetMapping("/list")
    public ModelAndView list(){
        System.out.println("--------------------");
        ModelAndView modelAndView = new ModelAndView();
        modelAndView.addObject("goodsList",goodService.listGoods());
        modelAndView.setViewName("index");
        return modelAndView;
    }
}
